layui.define(["layer"], function (p) {
  var f = layui.$,
    g = !1;
  b = function () { };
  b.prototype.usermenu_toggle = function () {
    var a = null,
      c = f("a.user-info-toggle"),
      d = f(".user-info-menu");
    c.on("click", function (e) {
      d.toggle(100);
    });
    d.on("mouseout", function (e) {
      a = window.setTimeout(function () {
        d.hide(100);
      }, 500);
    }).on("mousemove", function (e) {
      window.clearTimeout(a);
      d.show();
    });
  };
  b.prototype.fullScreen = function (a) {
    a = $(a).find("i");
    g
      ? (a.removeClass(" fa-compress"),
        a.addClass(" fa-expand"),
        (a =
          document.exitFullscreen ||
          document.mozCancelFullScreen ||
          document.webkitExitFullscreen ||
          document.webkitExitFullscreen)
          ? a.call(document)
          : "undefined" !== typeof window.ActiveXObject &&
          ((a = new ActiveXObject("WScript.Shell")),
            null !== a && a.SendKeys("{F11}")),
        (g = !1))
      : (a.removeClass(" fa-expand"),
        a.addClass(" fa-compress"),
        (a = document.documentElement),
        a.requestFullscreen
          ? a.requestFullscreen()
          : a.mozRequestFullScreen
            ? a.mozRequestFullScreen()
            : a.webkitRequestFullScreen
              ? a.webkitRequestFullScreen()
              : layui.layer.alert(
                "\u8be5\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u5168\u5c4f\uff01"
              ),
        (g = !0));
  };
  b.prototype.handleFullScreen = function () {
    var a = this;
    $(".btn-fullscreen").on("click", function (c) {
      a.fullScreen(this);
    });
  };
  b.prototype.ssmenubar = function () {
    var a = $(".sidebar-toggle");

    a.on("click", function (h) {
      var c = $(".main-sidebar"),
        d = $(".ml-m-r"),
        e = $(".logo"),
        k = $(".navtab"),
        l = $(".content-wrapper"),
        m = $(".logo-mini"),
        n = $(".logo-lg");
      h = $(window).width();
      h1 = $(window).height();
      a.hasClass("sideico-t2")
        ? (a.removeClass("sideico-t2").addClass("sideico-t3"),
          c.css("width", 80),
          d.hide(),
          e.css("width", 80),
          m.show(50),
          n.hide(50),
          k.css("width", h - 198),
          l.css("marginLeft", 80),
          l.css("height", h1 - 42))
        : (a.removeClass("sideico-t3").addClass("sideico-t2"),
          c.css("width", 260),
          d.show(),
          e.css("width", 260),
          m.hide(50),
          n.show(50),
          k.css("width", h - 378),
          l.css("marginLeft", 260),
          l.css("height", h1 - 42));
    });
  };
  b.prototype.logout = function () {
    $("#logout").on("click", function () {
      layer.confirm(
        "\u786e\u5b9a\u9000\u51fa\u7cfb\u7edf",
        { icon: 3, title: "\u64cd\u4f5c\u4fe1\u606f" },
        function (a) {
          $.ajax({
            url: kaige_page.logout_url,
            success: function (c) {
              c.status
                ? layer.msg(c.msg, { time: 2e3 }, function () {
                  szoa.removeToken();
                  szoa.delCache(szoa.client.userinfoKey);
                  window.location.href = szoa.client.path + '/pages/login.html';
                })
                : layer.msg(JSON.stringify(c.msg));
            },
            type: 'POST'
          });
        }
      );
    });
  };
  b.prototype.init = function () {
    this.usermenu_toggle();
    this.handleFullScreen();
    this.ssmenubar();
    this.logout();
  };
  f(window).on("load", function () {
    b.init();
  });
  var b = new b();
  p("kaigehome", b);
});
